package com.dp.vo;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

@Entity
@Table(name = "news_template")
public class NewsTemplate implements Serializable {
	    private static final long serialVersionUID = 1L;
	    @Id
	    @GeneratedValue(strategy = GenerationType.IDENTITY)
	    @Basic(optional = false)
	    @Column(name = "id")
	    private Integer id;
	    @Column(name = "templatename")
	    private String templatename;
	    @Column(name = "foldername")
	    private String foldername;
	    @OneToMany(fetch = FetchType.EAGER,mappedBy = "template")
	    @OrderBy("torder ASC")
	    private Set<NewsTemplatefield> templatefieldSet;
	    @OneToMany(fetch = FetchType.EAGER,mappedBy = "template")
	    @OrderBy("ftype ASC")
	    private Set<NewsTemplatefile> templatefileSet;
	    
	    public NewsTemplate(){
	    	
	    }
	    public NewsTemplate(Integer id){
	    	this.id=id;
	    }
	    
	    
		public Integer getId() {
			return id;
		}
		public void setId(Integer id) {
			this.id = id;
		}
		public String getTemplatename() {
			return templatename;
		}
		public void setTemplatename(String templatename) {
			this.templatename = templatename;
		}
		public String getFoldername() {
			return foldername;
		}
		public void setFoldername(String foldername) {
			this.foldername = foldername;
		}
		public Set<NewsTemplatefield> getTemplatefieldSet() {
			return templatefieldSet;
		}
		public void setTemplatefieldSet(Set<NewsTemplatefield> templatefieldSet) {
			this.templatefieldSet = templatefieldSet;
		}
		public Set<NewsTemplatefile> getTemplatefileSet() {
			return templatefileSet;
		}
		public void setTemplatefileSet(Set<NewsTemplatefile> templatefileSet) {
			this.templatefileSet = templatefileSet;
		}
		
		@Override
	    public int hashCode() {
	        int hash = 0;
	        hash += (id != null ? id.hashCode() : 0);
	        return hash;
	    }

	    @Override
	    public boolean equals(Object object) {
	        if (!(object instanceof NewsTemplate)) {
	            return false;
	        }
	        NewsTemplate other = (NewsTemplate) object;
	        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
	            return false;
	        }
	        return true;
	    }

	    @Override
	    public String toString() {
	        return "com.dp.vo.NewsTemplate[id=" + id + "]";
	    }
}
